package com.ysd.lis.controller.eq;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.eq.EqPatrolPlan;
import com.ysd.lis.entity.eq.EqSpotcheckPlan;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.eq.EqSpotcheckPlanService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 设备点检计划 前端控制器
 * </p>
 *
 * @author WH
 * @since 2024-08-26
 */
@RestController
@RequestMapping("/api/eq/spotcheckPlan")
public class EqSpotcheckPlanController extends BaseController {

    @Autowired
    private EqSpotcheckPlanService eqSpotcheckPlanService;
    @ApiOperation("分页查询")
    @GetMapping("/findSpotcheckPlanPageList")
    public Result findSpotcheckPlanPageList(CommonPageDto pageParam) {
        return eqSpotcheckPlanService.findSpotcheckPlanPageList(pageParam);
    }


    @ApiOperation("新增点检计划")
    @PostMapping("/addSpotcheckPlan")
    public Result addSpotcheckPlan(@RequestBody EqSpotcheckPlan eqSpotcheckPlan) {
        return eqSpotcheckPlanService.addSpotcheckPlan(eqSpotcheckPlan);
    }

    @ApiOperation("编辑点检计划")
    @PostMapping("/editSpotcheckPlan")
    public Result editSpotcheckPlan(@RequestBody EqSpotcheckPlan eqSpotcheckPlan) {
        return eqSpotcheckPlanService.editSpotcheckPlan(eqSpotcheckPlan);
    }

    @ApiOperation("启动或暂停点检计划")
    @PostMapping("/spotcheckPlanStopStart")
    public Result spotcheckPlanStopStart(@RequestBody EqSpotcheckPlan eqSpotcheckPlan) {
        return eqSpotcheckPlanService.spotcheckPlanStopStart(eqSpotcheckPlan);
    }
    @ApiOperation("执行点检计划")
    @GetMapping("/handleExecutePlan")
    public Result handleExecutePlan(EqSpotcheckPlan eqSpotcheckPlan) {
        return eqSpotcheckPlanService.handleExecutePlan(eqSpotcheckPlan);
    }

    @ApiOperation("通过id点检任务")
    @GetMapping("/findSpotcheckPlanById")
    public Result findSpotcheckPlanById(EqSpotcheckPlan eqSpotcheckPlan) {
        return eqSpotcheckPlanService.findSpotcheckPlanById(eqSpotcheckPlan);
    }

    @ApiOperation("批量删除点检计划")
    @PostMapping("/deleteSpotcheckPlan")
    public Result deleteSpotcheckPlan(@RequestBody List<EqSpotcheckPlan> eqSpotcheckPlans) {
        return eqSpotcheckPlanService.deleteSpotcheckPlan(eqSpotcheckPlans);
    }
}
